<?php

/**
 * PageState form base class.
 *
 * @method PageState getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePageStateForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'page_id'        => new sfWidgetFormInputHidden(),
      'state'          => new sfWidgetFormInputText(),
      'dialog_flags'   => new sfWidgetFormInputText(),
      'mail_flags'     => new sfWidgetFormInputText(),
      'is_new_page'    => new sfWidgetFormInputCheckbox(),
      'has_added_app'  => new sfWidgetFormInputCheckbox(),
      'installed_at'   => new sfWidgetFormDateTime(),
      'uninstalled_at' => new sfWidgetFormDateTime(),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'page_id'        => new sfValidatorChoice(array('choices' => array($this->getObject()->get('page_id')), 'empty_value' => $this->getObject()->get('page_id'), 'required' => false)),
      'state'          => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'dialog_flags'   => new sfValidatorInteger(array('required' => false)),
      'mail_flags'     => new sfValidatorInteger(array('required' => false)),
      'is_new_page'    => new sfValidatorBoolean(array('required' => false)),
      'has_added_app'  => new sfValidatorBoolean(array('required' => false)),
      'installed_at'   => new sfValidatorDateTime(array('required' => false)),
      'uninstalled_at' => new sfValidatorDateTime(array('required' => false)),
      'created_at'     => new sfValidatorDateTime(),
      'updated_at'     => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('page_state[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PageState';
  }

}
